package com.huiquan.slang.dao;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.slang.domain.SlangPackage;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class SlangPackageDao extends EnhancedBaseDao<SlangPackage> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "SLANG_PACKAGE.";

	public SlangPackageDao() {
		super(space);
	}

	// 将一个未分配的包分配给一个用户
	public int updateOnePackageToUser(Long userId) {
		Map<String, Object> param = new HashMap<>();
		param.put("uid", userId);
		return update(space + "UPDATE_ONE_PACKAGE_TO_USER", param, sqlMapClient);
	}
}
